package com.mofang.powerdekorhelper.activity.mine;

import android.graphics.Bitmap;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.BaseActivity;
import com.mofang.powerdekorhelper.utils.L;
import com.mofang.powerdekorhelper.utils.LoadPrograss;
import com.mofang.powerdekorhelper.utils.UrlTools;
import com.mofang.powerdekorhelper.witget.TitleBar;

import butterknife.BindView;

/**
 * Created by luofei on 2016/9/8 0008.
 */

public class HelpAndFeedBackDetialesActivity extends BaseActivity {

    @BindView(R.id.help_and_feedback_detiales)
    TitleBar mTitleBar;

    @BindView(R.id.help_and_feedback_detiales_web)
    WebView feedbackDetialesWeb;

    LoadPrograss loadPrograss;

    String helpDetialesId;

    @Override
    public void initView() {
        inflateLayout(R.layout.activity_help_and_feedback_detiales_layout);
        initTitleBar2(mTitleBar, R.string.help_and_feedback);
        loadPrograss = new LoadPrograss(HelpAndFeedBackDetialesActivity.this);
    }

    @Override
    public void initData() {

        helpDetialesId = getIntent().getStringExtra("HelpDetialesId");

        feedbackDetialesWeb.getSettings().setJavaScriptEnabled(true);
        feedbackDetialesWeb.getSettings().setDomStorageEnabled(true);
        feedbackDetialesWeb.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
                loadPrograss.show();
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                loadPrograss.hide();
            }
        });
        String url = UrlTools.HelpAndFeedback + "result={'q_id': " + helpDetialesId + ",'native_boolean':true}";
        L.e("HelpAndFeedback", "HelpAndFeedback----------------->" + url);
        feedbackDetialesWeb.loadUrl(url);
    }
}
